<?php
/**
 * 分类管理
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-6-17
 * Time: 下午2:37
 */
namespace app\modules\cn\controllers;

use app\libs\IeltsController;
use app\libs\Method;
use app\modules\cn\models\Info;
use app\modules\content\models\Active;
use app\modules\content\models\Banner;
use app\modules\content\models\Calendar;
use app\modules\content\models\Classes;
use app\modules\content\models\Recommend;

class CalendarController extends IeltsController
{
    public $enableCsrfValidation = false;
    public $layout = 'cn';


    public function actionIndex()
    {
        $year = date('Y', time());
        $data = array();
        for ($i = 1; $i <= 12; $i++) {
            $data[$i - 1] = Calendar::find()->asArray()->where("year=$year and month=$i")->limit(31)->orderBy('date asc')->all();
        }
        $time = time();
        $recommend = Info::find()->asArray()->where('(cate=1 or cate=2) and pushTime<=' . $time)->orderBy('sort asc,id desc')->limit(4)->all();
        $course = Classes::find()->asArray()->limit(2)->orderBy('viewCount desc')->all();
        $focus = Recommend::find()->asArray()->where('type=2')->orderBy('sort asc,id desc')->limit(6)->all();
        $this->title = '申友雅思在线_雅思考试日历';
        $this->keywords = '雅思考试,雅思考试时间';
        $this->description = '申友雅思在线为提供2021雅思考试时间，想要报考雅思考试的学员可以在线咨询，获取更准确的雅思考试时间及流程，雅思资料下载，雅思水平能力测试。';
        return $this->render('index', ['data' => $data, 'recommend' => $recommend, 'course' => $course, 'focus' => $focus]);
    }

}